package com.zyf.security.controller;

import com.zyf.security.entities.User;
import com.zyf.security.service.impl.UserServiceImpl;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class testController {
    @Autowired
    UserServiceImpl userService;
    @PreAuthorize("hasAnyRole('ROLE_ADMIN')")
    @GetMapping("/test")
    public List<String> test(@RequestParam("username") String username){
//        return userService.getAll();
        return userService.getRole(username);
    }
}
